/*
 * @Description: webpack的开发环境配置
 * @Author: Yong
 * @Date: 2021-10-04 09:56:22
 * @LastEditTime: 2021-10-04 22:52:47
 */
// 合并webpack配置项
const webpackMerge = require('webpack-merge')
const baseConfig = require('./webpack.config.base')
const path = require('path')

/**
 * @type {import('webpack').WebpackOptionsNormalized}
 */
const devServer = {
    port: 7002,
    host: 'localhost',
    static: {
        directory: path.join(__dirname, 'public'),
        watch: true,
        publicPath: '../',
    },
    compress: true,
    // 在HTML5 history下 需要提供404页面
    historyApiFallback: true,
    hot: true,
    open: false,
    client: {
        logging: 'info',
    },
    watchFiles: {
        paths: ['src/**/*', 'public/**/*'],
    },
}

const devConfig = {
    mode: 'development',
    devServer: devServer,
}

module.exports = webpackMerge.merge(baseConfig, devConfig)
